﻿@model CommerceOne.Widgets.ProductGrid.ProductGridViewModel
           
<!-- Products list -->
<ul id="product_list" class="clear">
@if (Model != null && Model.ProductGrid != null)
{
    var cls = "alternate_item";
    for (int i = 0; i < Model.ProductGrid.Count; i++)
    {
        var item = Model.ProductGrid[i];
        if (i == 0) { cls = "first_item item"; }
        else if (i == Model.ProductGrid.Count -1) { cls = "last_item alternate_item"; }
        else
        {
            int remain = 0;
            Math.DivRem(i, 2, out remain);
            if (remain == 0) { cls="item"; }
            else { cls = "alternate_item"; }
        }
            
        <li class="ajax_block_product @cls clearfix">
            <h3><a class="product_link" href="@item.Url" title="@item.Name">@item.ShortName</a></h3>
            @if (item.DefaultPicture != null)
            {
            <a href="@item.Url" class="product_img_link" title="@item.Name">
                <img src="@item.DefaultPicture.Home" alt="@item.Name" width="250" height="125" />
            </a>
                }
            <p class="compare checkbox">
                <input type="checkbox" onclick="checkForComparison(2)" class="comparator" id="comparator_item_1"
                    value="1" />
                <label for="comparator_item_1">
                    Select to compare</label></p>
            <div>
                <span class="price">$@item.ListPrice.Value.ToString("###,##0.00")</span> 
                <a class="add2cart" href="/Add/@item.ID/1/?returnUrl=@Request.Url.PathAndQuery" title="Add to cart">Add to cart</a>
                
            </div>
        </li>
    }
}
</ul>
<div class="clearblock">
</div>
<!-- /Products list -->
